#include <curl/curl.h>
#include <stdio.h>
#include <unistd.h>

#include "tcpsrv.h"

int purgeurl(char *url,char *ip){
        CURL *curl;
        CURLcode res;
        struct curl_slist *headers=NULL;
        curl = curl_easy_init();
	//fprintf(stderr,"%s %s",url,ip);
        if (curl){
                curl_easy_setopt(curl,CURLOPT_URL,url);
		curl_easy_setopt(curl,CURLOPT_INTERFACE,ip);
                curl_easy_setopt(curl,CURLOPT_CUSTOMREQUEST,"PURGE");
                curl_easy_setopt(curl,CURLOPT_HTTPHEADER,headers);
                curl_easy_perform(curl);
	 }
}
